package cn.zhou.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author: zhou
 * @Date: Create in 15:10 2020/7/24
 */
@RestController
@RefreshScope
public class ConfigClientController {

    //从配置文件中取前缀为server.port的值：注意这个模块关联了两个yml
    @Value("${server.port}")
    private String serverPort;

    @Value("${config.info}")
    private String configInfo;

    @GetMapping("/configInfo")
    public String getConfigInfo(){
        return configInfo + "serverPort: " + "\n" +serverPort;
    }
}


